<template>
  <div class="tab-control">
    <div v-for="(value,index) in title" @click="change(index)">
      <span :class="{'active':$store.state.tabActIndex==index}">{{value}}</span>
    </div>
  </div>
</template>

<script>
  export default{
    name:'',
    props:{
      title:{
        type:Array,
        default(){
          return []
        }
      }
    },
    data(){
      return {
          actIndex:1,
          itemName:['pop','new','sell']
       }
    },
    methods:{
      change(i){
        this.$store.state.tabActIndex=i
        this.$emit('tabClick',this.itemName[i])

      }
    },
    components:{

    }
  }
</script>

<style scoped>
  .tab-control{
    display: flex;
    text-align: center;
    font-size: 16px;
    background-color: white;
  }
  .tab-control div{
    flex: 1;
    height: 40px;
    line-height: 40px;
  }
  .tab-control span{
    padding-bottom: 5px;
  }
  .active{
    color: var(--color-high-text);
    border-bottom: 4px solid var(--color-high-text);
  }

</style>
